package com.tongji.showroom.command
{
	import com.tongji.showroom.events.GetUserSceneEvent;
	import com.tongji.showroom.model.GetUserSceneModel;
	import com.tongji.showroom.model.UserSceneModel;
	import com.tongji.showroom.service.UserSceneService;
	
	import org.robotlegs.mvcs.Command;
	
	/**
	 * 
	 * @author jiarong
	 * 2011-11-1
	 *
	 */
	
	public class GetUserSceneCommand extends Command
	{
		[Inject]
		public var event:GetUserSceneEvent;
		
		[Inject]
		public var service:UserSceneService;
		
		[Inject]
		public var model:UserSceneModel;
		
		public function GetUserSceneCommand()
		{
			super();
		}
		
		override public function execute():void
		{
			switch(event.type)
			{
				case GetUserSceneEvent.GET_USER_SCENE:
					service.getUserScene(event.userId, event.currentPage, event.pageSize);
					break;
				case GetUserSceneEvent.UPDATE_USER_SCENE:
					model.updateUserScene(event.scene);
					break;
			}
		}
	}
}